﻿<Window x:Class="PlaylistCopy.Views.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:p="clr-namespace:PlaylistCopy.Properties"
        xmlns:converters="clr-namespace:PlaylistCopy.Converters"
        xmlns:helpers="clr-namespace:PlaylistCopy.Helpers"
        xmlns:impl="clr-namespace:PlaylistCopy.Services.Impl"
        Title="PlaylistCopy" Height="450" Width="525"
        DataContext="{Binding Source={StaticResource ViewModelLocator}, Path=MainWindowVm}"
        impl:WindowFactory.IsRegisteredView="True" 
        WindowStartupLocation="CenterScreen"
        MinHeight="450"
        MinWidth="525">
    <Window.Resources>
        <converters:EnumToBooleanConverter x:Key="EnumToBooleanConverter" />
    </Window.Resources>

    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="65"></RowDefinition>
            <RowDefinition Height="65"></RowDefinition>
            <RowDefinition Height="65"></RowDefinition>
            <RowDefinition Height="*"></RowDefinition>
            <RowDefinition Height="Auto"></RowDefinition>
        </Grid.RowDefinitions>
        
        <Grid Grid.Row="0">
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="80"></ColumnDefinition>
                <ColumnDefinition Width="*"></ColumnDefinition>
            </Grid.ColumnDefinitions>
            <Image Source="../Images/Other/logo.png" Height="60" ></Image>
            <Grid Grid.Column="1">
                <Grid.RowDefinitions>
                    <RowDefinition Height="Auto"></RowDefinition>
                    <RowDefinition Height="*"></RowDefinition>
                </Grid.RowDefinitions>
                
                <TextBlock Grid.Row="0" Margin="0, 20, 0, 0" Text="PlaylistCopy" FontWeight="Bold" FontSize="15"></TextBlock>
                <TextBlock Grid.Row="1" Text="{x:Static p:Resources.PlaylistDescription}"></TextBlock>
            </Grid>
        </Grid>

        <Grid Grid.Row="1" Margin="5">
            <Grid.RowDefinitions>
                <RowDefinition Height="Auto"></RowDefinition>
                <RowDefinition Height="*"></RowDefinition>
            </Grid.RowDefinitions>

            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="*"></ColumnDefinition>
                <ColumnDefinition Width="110"></ColumnDefinition>
            </Grid.ColumnDefinitions>

            <TextBlock Grid.ColumnSpan="2" Text="{x:Static p:Resources.PlaylistPathLabel}"></TextBlock>
            <TextBox Grid.Row="1" Grid.Column="0" Text="{Binding PlaylistPath}" IsReadOnly="True" Margin="5"></TextBox>
            <Button Width="80" Grid.Row="1" Command="{Binding OpenPlaylistCommand}" Grid.Column="1" Margin="5" IsCancel="True" Padding="5">
                <StackPanel Orientation="Horizontal">
                    <Image Width="16" Height="16" Source="/PlaylistCopy;component/Images/music.png" Margin="0,0,5,0" />
                    <TextBlock Text="{x:Static p:Resources.Open}" VerticalAlignment="Center" />
                </StackPanel>
            </Button>
        </Grid>

        <Grid Grid.Row="2" Margin="5">

            <Grid.RowDefinitions>
                <RowDefinition Height="Auto"></RowDefinition>
                <RowDefinition Height="*"></RowDefinition>
            </Grid.RowDefinitions>

            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="*"></ColumnDefinition>
                <ColumnDefinition Width="110"></ColumnDefinition>
            </Grid.ColumnDefinitions>

            <TextBlock Grid.ColumnSpan="2" Text="{x:Static p:Resources.OutputDirectory}"></TextBlock>
            <TextBox Grid.Row="1" Grid.Column="0" Text="{Binding DestinationPath}" IsReadOnly="True" Margin="5" ></TextBox>
            <Button Width="80" Grid.Row="1" Grid.Column="1" Command="{Binding OpenDestinationPathCommand}" Margin="5" Padding="5">
                <StackPanel Orientation="Horizontal">
                    <Image Width="16" Height="16" Source="/PlaylistCopy;component/Images/folder.png" Margin="0,0,5,0" />
                    <TextBlock Text="{x:Static p:Resources.Select}" VerticalAlignment="Center" />
                </StackPanel>
            </Button>
        </Grid>

        <Grid Grid.Row="3" Margin="5">
            <Grid.RowDefinitions>
                <RowDefinition Height="Auto"></RowDefinition>
                <RowDefinition Height="*"></RowDefinition>
                <RowDefinition Height="*"></RowDefinition>
            </Grid.RowDefinitions>
            <TextBlock Text="{x:Static p:Resources.Mode}"></TextBlock>
            <Grid  Grid.Row="1" Margin="5,1,0,0">
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="Auto"/>
                    <ColumnDefinition Width="*"></ColumnDefinition>
                </Grid.ColumnDefinitions>

                <StackPanel Grid.Column="0">
                    <RadioButton Content="{x:Static p:Resources.Direct}"
                 IsChecked="{Binding CopyMode,
                            Converter={StaticResource EnumToBooleanConverter},
                            ConverterParameter={x:Static helpers:CopyMode.Direct}}" />
                    <RadioButton Content="{x:Static p:Resources.Preserve}" Name="RadioButtonPreserve"
                 IsChecked="{Binding CopyMode,
                            Converter={StaticResource EnumToBooleanConverter},
                            ConverterParameter={x:Static helpers:CopyMode.PreserveStrcture}}" />
                    <RadioButton Content="{x:Static p:Resources.TryPreserve}"
                 IsChecked="{Binding CopyMode,
                            Converter={StaticResource EnumToBooleanConverter},
                            ConverterParameter={x:Static helpers:CopyMode.TryPreserveStructure}}" />
                    <CheckBox Margin="0,5,0,0" Content="{x:Static p:Resources.OverwriteFiles}" 
                              IsChecked="{Binding Path=OverwriteFiles}"></CheckBox>
                </StackPanel>

                <TextBlock Margin="5,0,5,0" Grid.Column="1" Text="{Binding ModeDescription}" TextWrapping="Wrap"></TextBlock>
            </Grid>
            <Grid Grid.Row="2" Height="55">
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="*"></ColumnDefinition>
                    <ColumnDefinition Width="110"></ColumnDefinition>
                </Grid.ColumnDefinitions>
                <Grid.RowDefinitions>
                    <RowDefinition Height="Auto"></RowDefinition>
                    <RowDefinition Height="*"></RowDefinition>
                </Grid.RowDefinitions>
                <TextBlock Text="{x:Static p:Resources.RootFolder}"></TextBlock>
                <TextBox Grid.Row="1" Grid.Column="0" Margin="5" Text="{Binding RootPath}" IsReadOnly="True" IsEnabled="{Binding ElementName=RadioButtonPreserve, Path=IsChecked}"></TextBox>
                <Button Grid.Row="1" Command="{Binding OpenPreserveRootPath}" Width="80" IsEnabled="{Binding ElementName=RadioButtonPreserve, Path=IsChecked}" Grid.Column="1" Margin="5" Padding="5">
                    <StackPanel Orientation="Horizontal">
                        <Image Width="16" Height="16" Source="/PlaylistCopy;component/Images/folder.png" Margin="0,0,5,0" />
                        <TextBlock Text="{x:Static p:Resources.Select}" VerticalAlignment="Center" />
                    </StackPanel>
                </Button>
            </Grid>

        </Grid>
        <StackPanel Grid.Row="4" Orientation="Horizontal" FlowDirection="RightToLeft">
            <Button HorizontalAlignment="Right" Command="{Binding CopyPlaylistCommand}" Margin="20,5,5,10" Padding="5" Width="80"
                IsEnabled="{Binding CanStart}">
                <StackPanel Orientation="Horizontal">
                    <Image Width="16" Height="16" Source="/PlaylistCopy;component/Images/brick_go.png" Margin="0,0,5,0" />
                    <TextBlock Text="{x:Static p:Resources.Start}" VerticalAlignment="Center" />
                </StackPanel>
            </Button>
            <Button HorizontalAlignment="Right" Command="{Binding AboutCommand}" Margin="5,5,5,10" Padding="5" Width="80">
                <StackPanel Orientation="Horizontal">
                    <Image Width="16" Height="16" Source="/PlaylistCopy;component/Images/infocard.png" Margin="0,0,5,0" />
                    <TextBlock Text="{x:Static p:Resources.About}" VerticalAlignment="Center" />
                </StackPanel>
            </Button>
        </StackPanel>
    </Grid>
</Window>
